package org.rockyang.dike.core.impl;

import org.rockyang.dike.core.AuthorizationInfo;
import org.rockyang.dike.surpport.ShiroxPermission;
import org.rockyang.dike.surpport.ShiroxRole;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 授权信息接口实现
 * @author yangjian
 */
public class SimpleAuthorizationInfo implements AuthorizationInfo, Serializable {


	private List<ShiroxRole> roles = new ArrayList<>();

	private List<ShiroxPermission> permissions = new ArrayList<>();

	public SimpleAuthorizationInfo() {}

	public SimpleAuthorizationInfo(List<ShiroxRole> roles, List<ShiroxPermission> permissions) {
		this.roles = roles;
		this.permissions = permissions;
	}


	@Override
	public List<ShiroxRole> getRoles() {
		return roles;
	}

	@Override
	public List<ShiroxPermission> getPermissions() {
		return permissions;
	}

	@Override
	public void addRole(ShiroxRole role) {
		this.roles.add(role);
	}

	@Override
	public void addPermission(ShiroxPermission permission) {
		this.permissions.add(permission);
	}
}
